; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; RUN: llc -mtriple=m68k < %s | FileCheck %s

define void @sext_inreg_i1_to_i8(i1 %val, ptr %ptr) {
; CHECK-LABEL: sext_inreg_i1_to_i8:
; CHECK:         .cfi_startproc
; CHECK-NEXT:  ; %bb.0: ; %entry
; CHECK-NEXT:    move.b (7,%sp), %d0
; CHECK-NEXT:    and.b #1, %d0
; CHECK-NEXT:    neg.b %d0
; CHECK-NEXT:    move.l (8,%sp), %a0
; CHECK-NEXT:    move.b %d0, (%a0)
; CHECK-NEXT:    rts
entry:
  %cond = select i1 %val, i8 -1, i8 0
  store i8 %cond, ptr %ptr
  ret void
}

define void @sext_inreg_i1_to_i16(i1 %val, ptr %ptr) {
; CHECK-LABEL: sext_inreg_i1_to_i16:
; CHECK:         .cfi_startproc
; CHECK-NEXT:  ; %bb.0: ; %entry
; CHECK-NEXT:    move.b (7,%sp), %d0
; CHECK-NEXT:    and.l #255, %d0
; CHECK-NEXT:    and.w #1, %d0
; CHECK-NEXT:    neg.w %d0
; CHECK-NEXT:    move.l (8,%sp), %a0
; CHECK-NEXT:    move.w %d0, (%a0)
; CHECK-NEXT:    rts
entry:
  %cond = select i1 %val, i16 -1, i16 0
  store i16 %cond, ptr %ptr
  ret void
}

define void @sext_inreg_i1_to_i32(i1 %val, ptr %ptr) {
; CHECK-LABEL: sext_inreg_i1_to_i32:
; CHECK:         .cfi_startproc
; CHECK-NEXT:  ; %bb.0: ; %entry
; CHECK-NEXT:    move.b (7,%sp), %d0
; CHECK-NEXT:    and.l #255, %d0
; CHECK-NEXT:    and.l #1, %d0
; CHECK-NEXT:    neg.l %d0
; CHECK-NEXT:    move.l (8,%sp), %a0
; CHECK-NEXT:    move.l %d0, (%a0)
; CHECK-NEXT:    rts
entry:
  %cond = select i1 %val, i32 -1, i32 0
  store i32 %cond, ptr %ptr
  ret void
}

